//
//  CXThirdCollectionViewCell.m
//  ProjectOfBStage
//
//  Created by cuixin on 15/11/14.
//  Copyright © 2015年 cuixin. All rights reserved.
//

#import "CXThirdCollectionViewCell.h"
#import <SDWebImageManager.h>
#import <UIImageView+WebCache.h>

@implementation CXThirdCollectionViewCell
-(void)dealloc{
    [_imgView release];
    [_titleLable release];
    [super dealloc];
}
-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.imgView = [[UIImageView alloc] init];
        self.titleLable = [[UILabel alloc] init];
        
        [self.contentView addSubview:self.imgView];
        [self.contentView addSubview:self.titleLable];
        self.titleLable.font = [UIFont systemFontOfSize:HEIGHT_PRO(12)];
        [self.titleLable setTextColor:[UIColor grayColor]];
        
//        self.titleLable.backgroundColor = [UIColor greenColor];
//        self.imgView.backgroundColor = [UIColor cyanColor];
        
        [_imgView release];
        [_titleLable release];
        
    }
    return self;
}

-(void)layoutSubviews{
    [super layoutSubviews];
    self.imgView.frame = CGRectMake(0, 0, WIDTH_PRO(183), HEIGHT_PRO(100));
    self.titleLable.frame = CGRectMake(self.imgView.frame.origin.x, self.titleLable.frame.origin.y + self.imgView.frame.size.height + WIDTH_PRO(5), self.imgView.frame.size.width, HEIGHT_PRO(20));
}

-(void)setThirdModel:(CXThirdModel *)thirdModel{
    if (_thirdModel != thirdModel) {
        [_thirdModel release];
        _thirdModel = [thirdModel retain];
    }
    [self.imgView sd_setImageWithURL:[NSURL URLWithString:thirdModel.cover_url] placeholderImage:[UIImage imageNamed:@"wait.png"]];
    self.titleLable.text = thirdModel.name;
}

@end
